﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Expand.Patterns.Command;
using SpellCaster3.Core;
using System.Drawing;

namespace SpellCaster3.Commands
{
    class ChangeLocationButtonMacroCommand : ICommand
    {
        private ButtonMacro _Receiver;
        private HomeForm _Form;
        private Point _LastLocation;
        private Point _NewLocation;

        public ChangeLocationButtonMacroCommand(HomeForm form, ButtonMacro receiver, Point lastlocation, Point newLocation)
        {
            _Receiver = receiver;
            _LastLocation = lastlocation;
            _NewLocation = newLocation;
            _Form = form;
        }

        public object Receiver
        {
            get { return _Receiver; }
        }

        public void Execute()
        {
            _Receiver.Position = _NewLocation;
            _Form.Icons[_Receiver].Location = _NewLocation;
        }

        public void UnExecute()
        {
            _Receiver.Position = _LastLocation;
            _Form.Icons[_Receiver].Location = _LastLocation;
        }
    }
}
